package uk.ac.tees.aetoolkit;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

/**
 * A Service class used as an Alarm Receiver
 * 
 * @author Sohail Rahman, Mark Williamson, Robert Sheffield.
 * 
 */
public class AlarmReceiver extends Service {

	/**
	 * Method called when the service is started.
	 */
	@Override
	public void onStart(Intent intent, int startId) {
		boolean weather = intent.getBooleanExtra("Weather", false);
		boolean mathQ = intent.getBooleanExtra("MathQ", false);
		Intent alertIntent = new Intent();
		alertIntent.putExtra("Weather", weather);
		alertIntent.putExtra("MathQ", mathQ);
		// Show DialogActivity when the AlarmReceiver starts.
		alertIntent.setClass(this, DialogActivity.class);
		alertIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		startActivity(alertIntent);
	}

	/**
	 * No additional clients are used so we return null here.
	 */
	@Override
	public IBinder onBind(Intent intent) {
		// We are not providing any binding so return null.
		return null;
	}
}
